package com.gwz.cardserver.dto.fight;

import com.gwz.cardserver.consts.CardTypeEnum;
import com.gwz.cardserver.consts.CardWeightEnums;
import lombok.Data;

import java.util.List;

@Data
public class DealDto {
    /**
     * 选中要出的牌
     */
    private List<CardDto> selectCardList;
    /**
     * 长度
     */
    private int length;
    /**
     * 权值
     */
    private int weight;
    /**
     * 类型
     */
    private int type;
    /**
     * 谁出的牌
     */
    private String userId;
    /**
     * 牌是否合法
     */
    private boolean isRegular;


    public DealDto(List<CardDto> selectCardList, String userId) {
        this.selectCardList = selectCardList;
        this.length=selectCardList.size();
        this.type = CardTypeEnum.getCardType(selectCardList);
        this.weight = CardWeightEnums.getWeight(selectCardList,this.type);
        this.userId = userId;
        this.isRegular = (this.type !=CardTypeEnum.NONE.getCode());
    }
}
